package com.itheima.static_case.Demo4;

public class Student2 {
    private String name;

    static Student2 student2 = null;

    private Student2() {
    }

    // 懒汉模式
    public static Student2 getInstance() {
        if (student2 == null) {
            student2 = new Student2();
        }
        return student2;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
